<?php
class Form_TD
{
    protected static $_classNames = array();

    public static function className ($type, $td)
    {
        if (empty(self::$_classNames))
        {
            $query = DB::select()
                ->from('form_td_class')
                ->execute();

            $ret = array();
            foreach ($query as $rs)
            {
                $type = $rs['type'];
                $column = $rs['column'];
                $key  = "{$type}_{$column}";
                $ret[$key] = $rs['className'];
            }

            self::$_classNames = $ret;
        }

        $key = $type."_".$td;
        return Arr::get(self::$_classNames, $key);
    }
}
